#! /bin/sh
# wget https://github.com/siderolabs/talos/releases/download/v1.6.5/metal-amd64.iso

get_talos() {
  # repo="radius-project/bicep"
  # file_name="rad-bicep-linux-x64"

  repo="siderolabs/talos"
  file_name="talosctl-linux-amd64"

  Version=$(curl -s https://api.github.com/repos/${repo}/tags | jq -r '.[0].name')
  echo "${Version}"
  cli="talosctl"
  bin_path="/usr/bin/"
  sudo rm -rf ${bin_path}/${cli}
  wget https://ghproxy.net/https://github.com/${repo}/releases/download/${Version}/${file_name}
  # tar -zxvf ${file_name}
  mv ${file_name} ${cli}
  chmod +x ${cli}
  sudo mv ${cli} ${bin_path}
  # rm -rf LICENSE README.md ${file_name}
}

get_talos
